import { WeaTools } from 'ecCom';

// 列表搜索
const searchUrls = {
  Search: '/api/doc/searchlist/list', // 查询文档
  Directory: '/api/doc/doccategory/list', // 文档目录
  Dummy: '/api/doc/dummydoc/list', // 虚拟目录
  DocLog: '/api/doc/log/list', // 文档日志
  DocShare: '/api/doc/share/list', // 文档共享
  MoveCopy: '/api/doc/movecopy/list', // 移动复制
  Monitor: '/api/doc/monitor/list', // 文档监控
  Share: '/api/doc/docbatchshare/list', // 批量共享
  DocRecycle: '/api/doc/recycle/list', // 文档回收站
  Subscribe: '/api/doc/subscription/list', // 文档订阅
  MultiRecycle: '/api/doc/console/multi/recycle/table', // 后台文档回收站
  More: '/api/doc/more/list', // 文档中心
  MoreOut: '/api/doc/out/more/list', // 登录前文档中心

  // 详情
  Detail_file: '/api/doc/acc/docAcc', // 文档详情，附件列表
  Detail_fileVersion: '/api/doc/acc/docAccVersion', // 文档详情，附件版本
  Detail_version: '/api/doc/detail/docVersion', // 文档详情，文档版本
};

export const doSearch = (module, params) => WeaTools.callApi(searchUrls[module], module == 'More' ? 'POST' : 'GET', params);

// 高级搜索
const conditionUrls = {
  Search: '/api/doc/searchlist/condition', // 查询文档
  Directory: '/api/doc/doccategory/condition', // 文档目录
  Dummy: '/api/doc/dummydoc/condition', // 虚拟目录
  DocLog: '/api/doc/log/condition', // 文档日志
  MoveCopy: '/api/doc/movecopy/condition', // 移动复制
  Monitor: '/api/doc/monitor/condition', // 文档监控
  Share: '/api/doc/docbatchshare/condition', // 批量共享
  Subscribe: '/api/doc/subscription/condition', // 文档订阅
  DocRecycle: '/api/doc/recycle/condition', // 文档回收站
  MultiRecycle: '/api/doc/console/multi/recycle/condition', // 后台回收站
  More: '/api/doc/more/condition', // 文档中心
  MoreOut: '/api/doc/out/more/condition', // 登录前文档中心
};

export const getConditionInfo = (module, params) => WeaTools.callApi(conditionUrls[module], 'GET', params);

// 右键菜单
const rightMenuUrls = {
  Search: '/api/doc/searchlist/rightMenu', // 查询文档
  Directory: '/api/doc/doccategory/rightMenu', // 文档目录
  Dummy: '/api/doc/dummydoc/rightMenu', // 虚拟目录
  DocLog: '/api/doc/log/rightMenu', // 文档日志
  MoveCopy: '/api/doc/movecopy/rightMenu', // 移动复制
  Monitor: '/api/doc/monitor/rightMenu', // 文档监控
  Share: '/api/doc/docbatchshare/rightMenu', // 批量共享
  DocRecycle: '/api/doc/recycle/rightMenu', // 文档回收站
  Subscribe: '/api/doc/subscription/rightMenu', // 文档订阅
  More: '/api/doc/more/rightMenu', // 文档中心
  MoreOut: '/api/doc/out/more/rightMenu', // 登录前文档中心
};

export const getRightMenu = (module, params) => WeaTools.callApi(rightMenuUrls[module], 'GET', params);

// 左侧树
const treeUrls = {
  Search: '/api/doc/searchlist/treeNode', // 查询文档
  Directory: '/api/doc/doccategory/treeNode', // 文档目录
  Dummy: '/api/doc/dummydoc/treeNode', // 虚拟目录
  Monitor: '/api/doc/monitor/treeNode', // 文档监控
  Share: '/api/doc/docbatchshare/treeNode', // 批量共享
  DocRecycle: '/api/doc/recycle/treeNode', // 文档回收站
  Subscribe: '/api/doc/subscription/treeNode', // 文档订阅
  MultiShare: '/api/doc/console/multi/share/treeNode', // 后台批量共享
  PopupSet: '/api/doc/console/multi/openWin/treeNode', // 后台弹出窗口
  MultiRecycle: '/api/doc/console/multi/recycle/treeNode', // 后台回收站
};

export const getTreeDatas = (module, params) => WeaTools.callApi(treeUrls[module], 'GET', params);

// 左侧树数量
const treeNumUrls = {
  Search: '/api/doc/searchlist/treeNodeNum', // 查询文档
};

export const getTreeNums = (module, params) => WeaTools.callApi(treeNumUrls[module], 'POST', params);

